﻿using System;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using advadev.CanOpen;


namespace advadev.CanOpen.UnitTests
{

    /// <summary>
    /// Represents the service data object download transfer unit tests
    /// </summary>
    [TestClass]
    public class ServiceDataObjectDownloadTransferTest : ICanOpenObjectDictionaryContainer
    {

        #region constructor tests
        /// <summary>
        /// Constructor test
        /// </summary>
        [TestMethod]
        public void ConstructorTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x579;
            ICanOpenValueObject canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true) { Value = 0x7F };
            ServiceDataObjectDownloadTransfer testObject = null;

            // can open value object null parameter
            try
            {
                testObject = new ServiceDataObjectDownloadTransfer(null, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
            catch
            {
                Assert.Fail();
            }

            // node id out of range parameter
            try
            {
                testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, 0, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
            try
            {
                testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, 128, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
        }
        #endregion constructor tests


        #region client side Unsigned8 tests
        /// <summary>
        /// Client side Unsigned8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned8ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x2F, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned8 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned8SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x0D, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned8 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned8BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned8 tests


        #region client side Integer8 tests
        /// <summary>
        /// Client side Integer8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger8ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x2F, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x9C, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer8 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger8SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x0D, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x9C, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer8 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger8BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x9C, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -100;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer8 tests


        #region client side Unsigned16 tests
        /// <summary>
        /// Client side Unsigned16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned16ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 10000
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x2B, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x10, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x27, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned16 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned16SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 10000
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x02, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x0B, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x10, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x27, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned16 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned16BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 10000
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x02, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x27, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x10, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD5, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned16 tests


        #region client side Integer16 tests
        /// <summary>
        /// Client side Integer16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger16ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -10000
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x2B, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xF0, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xD8, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer16 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger16SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -10000
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x02, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x0B, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xF0, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xD8, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer16 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger16BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -10000
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x02, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xD8, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xF0, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD5, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -10000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer16 tests


        #region client side Unsigned24 tests
        /// <summary>
        /// Client side Unsigned24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned24ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x27, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x42, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x0F, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned24 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned24SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x09, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x42, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0F, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned24 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned24BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x0F, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x42, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned24 tests


        #region client side Integer24 tests
        /// <summary>
        /// Client side Integer24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger24ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x27, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xC0, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xBD, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0xF0, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer24 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger24SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x09, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xC0, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xBD, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xF0, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer24 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger24BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xF0, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xBD, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xC0, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -1000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer24 tests


        #region client side Unsigned32 tests
        /// <summary>
        /// Client side Unsigned32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned32ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000000
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xCA, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x9A, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x3B, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned32SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000000
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x04, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xCA, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x9A, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x3B, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned32 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned32BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000000
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x04, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x3B, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x9A, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xCA, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned32 tests


        #region client side Integer32 tests
        /// <summary>
        /// Client side Integer32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger32ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000000
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x36, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x65, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0xC4, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger32SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000000
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x04, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x36, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x65, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xC4, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer32 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger32BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000000
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x04, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xC4, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x65, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x36, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -1000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer32 tests


        #region client side Real32 tests
        /// <summary>
        /// Client side Real32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideReal32ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 6.25
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0xC8, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Real32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideReal32SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 6.25
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x04, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xC8, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Real32 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideReal32BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 6.25
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x04, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xC8, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 6.25f;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Real32 tests


        #region client side Unsigned40 tests
        /// <summary>
        /// Client side Unsigned40 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned40SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100000000000
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xE8, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x76, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x48, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x17, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned40 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned40BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100000000000
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x17, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x48, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x76, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xE8, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned40 tests


        #region client side Integer40 tests
        /// <summary>
        /// Client side Integer40 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger40SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100000000000
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x18, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x89, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xB7, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xE8, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer40 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger40BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100000000000
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xE8, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xB7, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x89, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x18, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -100000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer40 tests


        #region client side Unsigned48 tests
        /// <summary>
        /// Client side Unsigned48 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned48SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100000000000000
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x06, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x7A, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x10, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xF3, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x5A, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned48 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned48BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 100000000000000
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x06, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x5A, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xF3, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x10, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x7A, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC5, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned48 tests


        #region client side Integer48 tests
        /// <summary>
        /// Client side Integer48 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger48SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100000000000000
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x06, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xC0, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x85, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xEF, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x0C, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0xA5, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer48 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger48BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -100000000000000
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x06, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xA5, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x0C, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xEF, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x85, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xC0, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC5, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -100000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer48 tests


        #region client side Unsigned56 tests
        /// <summary>
        /// Client side Unsigned56 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned56SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 10000000000000000
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xC1, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x6F, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xF2, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x86, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned56 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned56BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 10000000000000000
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x86, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xF2, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x6F, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xC1, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned56 tests


        #region client side Integer56 tests
        /// <summary>
        /// Client side Integer56 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger56SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -10000000000000000
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x3F, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x90, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x0D, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x79, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0xDC, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer56 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger56BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -10000000000000000
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x81, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xDC, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x79, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0D, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x90, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x3F, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x01, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -10000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer56 tests


        #region client side Unsigned64 tests
        /// <summary>
        /// Client side Unsigned64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned64SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000000000000000
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xA7, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xB3, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0xB6, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0xE0, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x1D, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x0D, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned64 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned64BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 1000000000000000000
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x0D, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xE0, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0xB6, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0xB3, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0xA7, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[1].CanId);
            Assert.AreEqual(0x82, testObject.PendingSendMessages[1].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[1].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x03, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned64 tests


        #region client side Integer64 tests
        /// <summary>
        /// Client side Integer64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger64SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000000000000000
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x9C, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x58, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x4C, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x49, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x1F, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x1D, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xF2, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer64 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger64BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value -1000000000000000000
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xF2, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x1F, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x49, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x4C, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x58, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x9C, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[1].CanId);
            Assert.AreEqual(0x82, testObject.PendingSendMessages[1].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[1].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = -1000000000000000000;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x03, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer64 tests


        #region client side Real64 tests
        /// <summary>
        /// Client side Real64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideReal64SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal64 canOpenValueObject = new CanOpenReal64(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 6.25
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x19, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x1D, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Real64 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideReal64BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal64 canOpenValueObject = new CanOpenReal64(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value 6.25
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x19, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[1].CanId);
            Assert.AreEqual(0x82, testObject.PendingSendMessages[1].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[1].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 6.25;
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x03, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Real64 tests


        #region client side VisibleString tests
        /// <summary>
        /// Client side VisibleString expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideVisibleStringExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value "a"
            canOpenValueObject.Value = "a";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x2F, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with value "abcd"
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x62, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x63, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side VisibleString segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideVisibleStringSegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value "abcdefg"
            canOpenValueObject.Value = "abcdefg";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x07, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x62, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x63, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x65, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x66, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x67, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = "abcdefg";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = "abcdefg";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = "abcdefg";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = "abcdefg";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side VisibleString block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideVisibleStringBlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value "abcdefgh"
            canOpenValueObject.Value = "abcdefgh";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x62, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x63, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x65, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x66, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x67, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[1].CanId);
            Assert.AreEqual(0x82, testObject.PendingSendMessages[1].Byte0);
            Assert.AreEqual(0x68, testObject.PendingSendMessages[1].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[1].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = "abcdefgh";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = "abcdefgh";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = "abcdefgh";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = "abcdefgh";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x03, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side VisibleString tests


        #region client side UnicodeString tests
        /// <summary>
        /// Client side UnicodeString expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnicodeStringExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value "a"
            canOpenValueObject.Value = "a";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x2B, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with value "ab"
            canOpenValueObject.Value = "ab";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x23, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x62, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = "ab";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = "ab";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = "ab";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side UnicodeString segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnicodeStringSegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value "abc"
            canOpenValueObject.Value = "abc";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x21, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x06, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x62, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x63, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = "abc";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = "abc";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = "abc";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0x19, 0x82, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = "abc";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x60, 0xCD, 0xAB, 0x0E, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side UnicodeString block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnicodeStringBlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0xABCD, 0x0E, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with value "abcd"
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xC2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x08, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x61, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x62, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x63, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x64, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[1].CanId);
            Assert.AreEqual(0x82, testObject.PendingSendMessages[1].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[1].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[1].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xD9, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x02, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = "abcd";
            testObject = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA0, 0xCD, 0xAB, 0x0E, 0x7F, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(2, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xA2, 0x03, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side UnicodeString tests


        #region is service data object download transfer request tests
        /// <summary>
        /// Is service data object download transfer request test
        /// </summary>
        [TestMethod]
        public void IsServiceDataObjectDownloadTransferRequestTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;

            // test with valid received can open message
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x667, 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);

            // test with not valid received can open message
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x667, 0x00, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNull(testObject);

            // test with can open object dictionary is null
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x667, 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), null, out testObject);
            Assert.AreEqual(false, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNull(testObject);

            // test with invalid node id
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x600, 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNull(testObject);
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x680, 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNull(testObject);

            // test with received can open message is null
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(null, this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNull(testObject);

            // test with changed COB-IDs
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage((UInt16)(sendCobId + nodeId), 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);

            // test with block size out of range
            try
            {
                isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x667, 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject, sendCobId, receiveCobId, 0);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
            try
            {
                isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(new CanOpenMessage(0x667, 0x2F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00), this, out testObject, sendCobId, receiveCobId, 128);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
        }
        #endregion is service data object download transfer request tests


        #region server side Unsigned8 tests
        /// <summary>
        /// Server side Unsigned8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned8ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            CanOpenUnsigned8 unknownCanOpenValueObject = new CanOpenUnsigned8(0x0000, 0x00, true, true);
            CanOpenUnsigned8 notWriteableCanOpenValueObject = new CanOpenUnsigned8(0x1008, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned8 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned8SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            CanOpenUnsigned8 unknownCanOpenValueObject = new CanOpenUnsigned8(0x0000, 0x00, true, true);
            CanOpenUnsigned8 notWriteableCanOpenValueObject = new CanOpenUnsigned8(0x1008, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned8 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned8BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            CanOpenUnsigned8 unknownCanOpenValueObject = new CanOpenUnsigned8(0x0000, 0x00, true, true);
            CanOpenUnsigned8 notWriteableCanOpenValueObject = new CanOpenUnsigned8(0x1008, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned8.Value = 0;
            canOpenValueObject.Value = 100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned8 tests


        #region server side Integer8 tests
        /// <summary>
        /// Server side Integer8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger8ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0x0008, 0x01, true, true);
            CanOpenInteger8 unknownCanOpenValueObject = new CanOpenInteger8(0x0000, 0x01, true, true);
            CanOpenInteger8 notWriteableCanOpenValueObject = new CanOpenInteger8(0x1008, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer8 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger8SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0x0008, 0x01, true, true);
            CanOpenInteger8 unknownCanOpenValueObject = new CanOpenInteger8(0x0000, 0x00, true, true);
            CanOpenInteger8 notWriteableCanOpenValueObject = new CanOpenInteger8(0x1008, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer8 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger8BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0x0008, 0x01, true, true);
            CanOpenInteger8 unknownCanOpenValueObject = new CanOpenInteger8(0x0000, 0x00, true, true);
            CanOpenInteger8 notWriteableCanOpenValueObject = new CanOpenInteger8(0x1008, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger8.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger8.Value = 0;
            canOpenValueObject.Value = -100;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger8.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer8 tests


        #region server side Unsigned16 tests
        /// <summary>
        /// Server side Unsigned16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned16ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0x0016, 0x00, true, true);
            CanOpenUnsigned16 unknownCanOpenValueObject = new CanOpenUnsigned16(0x0000, 0x00, true, true);
            CanOpenUnsigned16 notWriteableCanOpenValueObject = new CanOpenUnsigned16(0x1016, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 10000
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned16 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned16SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0x0016, 0x00, true, true);
            CanOpenUnsigned16 unknownCanOpenValueObject = new CanOpenUnsigned16(0x0000, 0x00, true, true);
            CanOpenUnsigned16 notWriteableCanOpenValueObject = new CanOpenUnsigned16(0x1016, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 10000
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned16 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned16BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0x0016, 0x00, true, true);
            CanOpenUnsigned16 unknownCanOpenValueObject = new CanOpenUnsigned16(0x0000, 0x00, true, true);
            CanOpenUnsigned16 notWriteableCanOpenValueObject = new CanOpenUnsigned16(0x1016, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 10000
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned16.Value = 0;
            canOpenValueObject.Value = 10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned16 tests


        #region server side Integer16 tests
        /// <summary>
        /// Server side Integer16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger16ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0x0016, 0x01, true, true);
            CanOpenInteger16 unknownCanOpenValueObject = new CanOpenInteger16(0x0000, 0x01, true, true);
            CanOpenInteger16 notWriteableCanOpenValueObject = new CanOpenInteger16(0x1016, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -10000
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer16 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger16SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0x0016, 0x01, true, true);
            CanOpenInteger16 unknownCanOpenValueObject = new CanOpenInteger16(0x0000, 0x00, true, true);
            CanOpenInteger16 notWriteableCanOpenValueObject = new CanOpenInteger16(0x1016, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -10000
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer16 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger16BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0x0016, 0x01, true, true);
            CanOpenInteger16 unknownCanOpenValueObject = new CanOpenInteger16(0x0000, 0x00, true, true);
            CanOpenInteger16 notWriteableCanOpenValueObject = new CanOpenInteger16(0x1016, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -10000
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger16.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger16.Value = 0;
            canOpenValueObject.Value = -10000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger16.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer16 tests


        #region server side Unsigned24 tests
        /// <summary>
        /// Server side Unsigned24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned24ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0x0024, 0x00, true, true);
            CanOpenUnsigned24 unknownCanOpenValueObject = new CanOpenUnsigned24(0x0000, 0x00, true, true);
            CanOpenUnsigned24 notWriteableCanOpenValueObject = new CanOpenUnsigned24(0x1024, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned24 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned24SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0x0024, 0x00, true, true);
            CanOpenUnsigned24 unknownCanOpenValueObject = new CanOpenUnsigned24(0x0000, 0x00, true, true);
            CanOpenUnsigned24 notWriteableCanOpenValueObject = new CanOpenUnsigned24(0x1024, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned24 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned24BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0x0024, 0x00, true, true);
            CanOpenUnsigned24 unknownCanOpenValueObject = new CanOpenUnsigned24(0x0000, 0x00, true, true);
            CanOpenUnsigned24 notWriteableCanOpenValueObject = new CanOpenUnsigned24(0x1024, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned24.Value = 0;
            canOpenValueObject.Value = 1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned24 tests


        #region server side Integer24 tests
        /// <summary>
        /// Server side Integer24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger24ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0x0024, 0x01, true, true);
            CanOpenInteger24 unknownCanOpenValueObject = new CanOpenInteger24(0x0000, 0x01, true, true);
            CanOpenInteger24 notWriteableCanOpenValueObject = new CanOpenInteger24(0x1024, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer24 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger24SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0x0024, 0x01, true, true);
            CanOpenInteger24 unknownCanOpenValueObject = new CanOpenInteger24(0x0000, 0x00, true, true);
            CanOpenInteger24 notWriteableCanOpenValueObject = new CanOpenInteger24(0x1024, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer24 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger24BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0x0024, 0x01, true, true);
            CanOpenInteger24 unknownCanOpenValueObject = new CanOpenInteger24(0x0000, 0x00, true, true);
            CanOpenInteger24 notWriteableCanOpenValueObject = new CanOpenInteger24(0x1024, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger24.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger24.Value = 0;
            canOpenValueObject.Value = -1000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger24.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer24 tests


        #region server side Unsigned32 tests
        /// <summary>
        /// Server side Unsigned32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned32ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            CanOpenUnsigned32 unknownCanOpenValueObject = new CanOpenUnsigned32(0x0000, 0x00, true, true);
            CanOpenUnsigned32 notWriteableCanOpenValueObject = new CanOpenUnsigned32(0x1032, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000000
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned32SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            CanOpenUnsigned32 unknownCanOpenValueObject = new CanOpenUnsigned32(0x0000, 0x00, true, true);
            CanOpenUnsigned32 notWriteableCanOpenValueObject = new CanOpenUnsigned32(0x1032, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000000
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned32 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned32BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            CanOpenUnsigned32 unknownCanOpenValueObject = new CanOpenUnsigned32(0x0000, 0x00, true, true);
            CanOpenUnsigned32 notWriteableCanOpenValueObject = new CanOpenUnsigned32(0x1032, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000000
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned32 tests


        #region server side Integer32 tests
        /// <summary>
        /// Server side Integer32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger32ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            CanOpenInteger32 unknownCanOpenValueObject = new CanOpenInteger32(0x0000, 0x01, true, true);
            CanOpenInteger32 notWriteableCanOpenValueObject = new CanOpenInteger32(0x1032, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000000
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger32SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            CanOpenInteger32 unknownCanOpenValueObject = new CanOpenInteger32(0x0000, 0x00, true, true);
            CanOpenInteger32 notWriteableCanOpenValueObject = new CanOpenInteger32(0x1032, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000000
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer32 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger32BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            CanOpenInteger32 unknownCanOpenValueObject = new CanOpenInteger32(0x0000, 0x00, true, true);
            CanOpenInteger32 notWriteableCanOpenValueObject = new CanOpenInteger32(0x1032, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000000
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = -1000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer32 tests


        #region server side Real32 tests
        /// <summary>
        /// Server side Real32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideReal32ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0x0032, 0x02, true, true);
            CanOpenReal32 unknownCanOpenValueObject = new CanOpenReal32(0x0000, 0x02, true, true);
            CanOpenReal32 notWriteableCanOpenValueObject = new CanOpenReal32(0x1032, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 6.25
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Real32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideReal32SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0x0032, 0x02, true, true);
            CanOpenReal32 unknownCanOpenValueObject = new CanOpenReal32(0x0000, 0x00, true, true);
            CanOpenReal32 notWriteableCanOpenValueObject = new CanOpenReal32(0x1032, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 6.25
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Real32 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideReal32BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0x0032, 0x02, true, true);
            CanOpenReal32 unknownCanOpenValueObject = new CanOpenReal32(0x0000, 0x00, true, true);
            CanOpenReal32 notWriteableCanOpenValueObject = new CanOpenReal32(0x1032, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 6.25
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 6.25f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion server side Real32 tests


        #region server side Unsigned40 tests
        /// <summary>
        /// Server side Unsigned40 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned40SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0x0040, 0x00, true, true);
            CanOpenUnsigned40 unknownCanOpenValueObject = new CanOpenUnsigned40(0x0000, 0x00, true, true);
            CanOpenUnsigned40 notWriteableCanOpenValueObject = new CanOpenUnsigned40(0x1040, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100000000000
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned40.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned40.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned40 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned40BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0x0040, 0x00, true, true);
            CanOpenUnsigned40 unknownCanOpenValueObject = new CanOpenUnsigned40(0x0000, 0x00, true, true);
            CanOpenUnsigned40 notWriteableCanOpenValueObject = new CanOpenUnsigned40(0x1040, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100000000000
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned40.Value);
            Assert.IsNull(testObject.AbortCode);
            // FROM HERE!
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned40.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned40.Value = 0;
            canOpenValueObject.Value = 100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned40 tests


        #region server side Integer40 tests
        /// <summary>
        /// Server side Integer40 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger40SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0x0040, 0x01, true, true);
            CanOpenInteger40 unknownCanOpenValueObject = new CanOpenInteger40(0x0000, 0x00, true, true);
            CanOpenInteger40 notWriteableCanOpenValueObject = new CanOpenInteger40(0x1040, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100000000000
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger40.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger40.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer40 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger40BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0x0040, 0x01, true, true);
            CanOpenInteger40 unknownCanOpenValueObject = new CanOpenInteger40(0x0000, 0x00, true, true);
            CanOpenInteger40 notWriteableCanOpenValueObject = new CanOpenInteger40(0x1040, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100000000000
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger40.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger40.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger40.Value = 0;
            canOpenValueObject.Value = -100000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger40.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer40 tests


        #region server side Unsigned48 tests
        /// <summary>
        /// Server side Unsigned48 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned48SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0x0048, 0x00, true, true);
            CanOpenUnsigned48 unknownCanOpenValueObject = new CanOpenUnsigned48(0x0000, 0x00, true, true);
            CanOpenUnsigned48 notWriteableCanOpenValueObject = new CanOpenUnsigned48(0x1048, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100000000000000
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned48 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned48BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0x0048, 0x00, true, true);
            CanOpenUnsigned48 unknownCanOpenValueObject = new CanOpenUnsigned48(0x0000, 0x00, true, true);
            CanOpenUnsigned48 notWriteableCanOpenValueObject = new CanOpenUnsigned48(0x1048, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 100000000000000
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned48.Value = 0;
            canOpenValueObject.Value = 100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned48 tests


        #region server side Integer48 tests
        /// <summary>
        /// Server side Integer48 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger48SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0x0048, 0x01, true, true);
            CanOpenInteger48 unknownCanOpenValueObject = new CanOpenInteger48(0x0000, 0x00, true, true);
            CanOpenInteger48 notWriteableCanOpenValueObject = new CanOpenInteger48(0x1048, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100000000000000
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer48 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger48BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0x0048, 0x01, true, true);
            CanOpenInteger48 unknownCanOpenValueObject = new CanOpenInteger48(0x0000, 0x00, true, true);
            CanOpenInteger48 notWriteableCanOpenValueObject = new CanOpenInteger48(0x1048, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -100000000000000
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger48.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger48.Value = 0;
            canOpenValueObject.Value = -100000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger48.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer48 tests


        #region server side Unsigned56 tests
        /// <summary>
        /// Server side Unsigned56 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned56SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0x0056, 0x00, true, true);
            CanOpenUnsigned56 unknownCanOpenValueObject = new CanOpenUnsigned56(0x0000, 0x00, true, true);
            CanOpenUnsigned56 notWriteableCanOpenValueObject = new CanOpenUnsigned56(0x1056, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 10000000000000000
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned56 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned56BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0x0056, 0x00, true, true);
            CanOpenUnsigned56 unknownCanOpenValueObject = new CanOpenUnsigned56(0x0000, 0x00, true, true);
            CanOpenUnsigned56 notWriteableCanOpenValueObject = new CanOpenUnsigned56(0x1056, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 10000000000000000
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned56.Value = 0;
            canOpenValueObject.Value = 10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned56 tests


        #region server side Integer56 tests
        /// <summary>
        /// Server side Integer56 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger56SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0x0056, 0x01, true, true);
            CanOpenInteger56 unknownCanOpenValueObject = new CanOpenInteger56(0x0000, 0x00, true, true);
            CanOpenInteger56 notWriteableCanOpenValueObject = new CanOpenInteger56(0x1056, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -10000000000000000
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer56 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger56BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0x0056, 0x01, true, true);
            CanOpenInteger56 unknownCanOpenValueObject = new CanOpenInteger56(0x0000, 0x00, true, true);
            CanOpenInteger56 notWriteableCanOpenValueObject = new CanOpenInteger56(0x1056, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -10000000000000000
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger56.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger56.Value = 0;
            canOpenValueObject.Value = -10000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger56.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer56 tests


        #region server side Unsigned64 tests
        /// <summary>
        /// Server side Unsigned64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned64SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0x0064, 0x00, true, true);
            CanOpenUnsigned64 unknownCanOpenValueObject = new CanOpenUnsigned64(0x0000, 0x00, true, true);
            CanOpenUnsigned64 notWriteableCanOpenValueObject = new CanOpenUnsigned64(0x1064, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000000000000000
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned64 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned64BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0x0064, 0x00, true, true);
            CanOpenUnsigned64 unknownCanOpenValueObject = new CanOpenUnsigned64(0x0000, 0x00, true, true);
            CanOpenUnsigned64 notWriteableCanOpenValueObject = new CanOpenUnsigned64(0x1064, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 1000000000000000000
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnsigned64.Value = 0;
            canOpenValueObject.Value = 1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Unsigned64 tests


        #region server side Integer64 tests
        /// <summary>
        /// Server side Integer64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger64SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0x0064, 0x01, true, true);
            CanOpenInteger64 unknownCanOpenValueObject = new CanOpenInteger64(0x0000, 0x00, true, true);
            CanOpenInteger64 notWriteableCanOpenValueObject = new CanOpenInteger64(0x1064, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000000000000000
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer64 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger64BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0x0064, 0x01, true, true);
            CanOpenInteger64 unknownCanOpenValueObject = new CanOpenInteger64(0x0000, 0x00, true, true);
            CanOpenInteger64 notWriteableCanOpenValueObject = new CanOpenInteger64(0x1064, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value -1000000000000000000
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenInteger64.Value = 0;
            canOpenValueObject.Value = -1000000000000000000;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Integer64 tests


        #region server side Real64 tests
        /// <summary>
        /// Server side Real64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideReal64SegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal64 canOpenValueObject = new CanOpenReal64(0x0064, 0x02, true, true);
            CanOpenReal64 unknownCanOpenValueObject = new CanOpenReal64(0x0000, 0x00, true, true);
            CanOpenReal64 notWriteableCanOpenValueObject = new CanOpenReal64(0x1064, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 6.25
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((double)0, _canOpenReal64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((double)0, _canOpenReal64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Real64 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideReal64BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenReal64 canOpenValueObject = new CanOpenReal64(0x0064, 0x02, true, true);
            CanOpenReal64 unknownCanOpenValueObject = new CanOpenReal64(0x0000, 0x00, true, true);
            CanOpenReal64 notWriteableCanOpenValueObject = new CanOpenReal64(0x1064, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value 6.25
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((double)0, _canOpenReal64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 6.25;
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((double)0, _canOpenReal64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side Real64 tests


        #region server side VisibleString tests
        /// <summary>
        /// Server side VisibleString expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideVisibleStringExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0x0128, 0x02, true, true);
            CanOpenVisibleString unknownCanOpenValueObject = new CanOpenVisibleString(0x0000, 0x02, true, true);
            CanOpenVisibleString notWriteableCanOpenValueObject = new CanOpenVisibleString(0x1128, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value "abcd"
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenVisibleString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenVisibleString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side VisibleString segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideVisibleStringSegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0x0128, 0x02, true, true);
            CanOpenVisibleString unknownCanOpenValueObject = new CanOpenVisibleString(0x0000, 0x02, true, true);
            CanOpenVisibleString notWriteableCanOpenValueObject = new CanOpenVisibleString(0x1128, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value "abcdefgh"
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenVisibleString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenVisibleString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side VisibleString block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideVisibleStringBlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0x0128, 0x02, true, true);
            CanOpenVisibleString unknownCanOpenValueObject = new CanOpenVisibleString(0x0000, 0x02, true, true);
            CanOpenVisibleString notWriteableCanOpenValueObject = new CanOpenVisibleString(0x1128, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value "abcdefgh"
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenVisibleString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcdefgh";
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenVisibleString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side VisibleString tests


        #region server side UnicodeString tests
        /// <summary>
        /// Server side UnicodeString expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnicodeStringExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0x0228, 0x02, true, true);
            CanOpenUnicodeString unknownCanOpenValueObject = new CanOpenUnicodeString(0x0000, 0x02, true, true);
            CanOpenUnicodeString notWriteableCanOpenValueObject = new CanOpenUnicodeString(0x1228, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value "ab"
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "ab";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "ab";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "ab";
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenUnicodeString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "ab";
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenUnicodeString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side UnicodeString segmented transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnicodeStringSegmentedTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0x0228, 0x02, true, true);
            CanOpenUnicodeString unknownCanOpenValueObject = new CanOpenUnicodeString(0x0000, 0x02, true, true);
            CanOpenUnicodeString notWriteableCanOpenValueObject = new CanOpenUnicodeString(0x1228, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value "abcd"
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenUnicodeString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenUnicodeString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side UnicodeString block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnicodeStringBlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0x0228, 0x02, true, true);
            CanOpenUnicodeString unknownCanOpenValueObject = new CanOpenUnicodeString(0x0000, 0x02, true, true);
            CanOpenUnicodeString notWriteableCanOpenValueObject = new CanOpenUnicodeString(0x1228, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;

            // test with value "abcd"
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with changed COB-IDs
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId, blockSize);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[1]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with unkown object
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenUnicodeString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not writeable object
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(notWriteableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(string.Empty, _canOpenUnicodeString.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010002", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }
        #endregion server side UnicodeString tests


        #region validation tests
        /// <summary>
        /// Unsigned validation test
        /// </summary>
        [TestMethod]
        public void UnsignedValidationTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenUnsigned32.ValueChanging += new ValueChangingEventHandler((object sender, ValueChangingEventArgs args) =>
            {
                if ((ulong)args.NewValue == 13)
                {
                    args.AbortCode = new CanOpenAbortCode(0x0A, 0x0B, 0x0C, 0x0D);
                }
            });

            // test with valid value
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 10;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with invalid value
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 13;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, _canOpenUnsigned32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x0D0C0B0A", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Integer validation test
        /// </summary>
        [TestMethod]
        public void IntegerValidationTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenInteger32.ValueChanging += new ValueChangingEventHandler((object sender, ValueChangingEventArgs args) =>
            {
                if ((long)args.NewValue == 13)
                {
                    args.AbortCode = new CanOpenAbortCode(0x0A, 0x0B, 0x0C, 0x0D);
                }
            });

            // test with valid value
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = 10;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with invalid value
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = 13;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, _canOpenInteger32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x0D0C0B0A", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Real32 validation test
        /// </summary>
        [TestMethod]
        public void Real32ValidationTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0x0032, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenReal32.ValueChanging += new ValueChangingEventHandler((object sender, ValueChangingEventArgs args) =>
            {
                if ((float)args.NewValue == 13.5)
                {
                    args.AbortCode = new CanOpenAbortCode(0x0A, 0x0B, 0x0C, 0x0D);
                }
            });

            // test with valid value
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 10.5f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with invalid value
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 13.5f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((float)0, _canOpenReal32.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x0D0C0B0A", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Real64 validation test
        /// </summary>
        [TestMethod]
        public void Real64ValidationTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            byte nodeId = 103;
            CanOpenReal64 canOpenValueObject = new CanOpenReal64(0x0064, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenReal64.ValueChanging += new ValueChangingEventHandler((object sender, ValueChangingEventArgs args) =>
            {
                if ((double)args.NewValue == 13.5)
                {
                    args.AbortCode = new CanOpenAbortCode(0x0A, 0x0B, 0x0C, 0x0D);
                }
            });

            // test with valid value
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 10.5;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with invalid value
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 13.5;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual((double)0, _canOpenReal64.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x0D0C0B0A", testObject.AbortCode.HexString);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ContinueAfterSendingMessages();
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Unsigned value changed test
        /// </summary>
        [TestMethod]
        public void UnsignedValueChangedTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            bool valueChangedResult = false;
            byte nodeId = 103;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenUnsigned32.ValueChanged += new ValueChangedEventHandler((object sender, ValueChangedEventArgs args) =>
            {
                if ((ulong)args.CurrentValue == 10 && (ulong)args.OldValue == 0)
                {
                    valueChangedResult = true;
                }
            });

            // test with valid value
            valueChangedResult = false;
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 10;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.FinalizeTransfer();
            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with valid value in silent mode
            valueChangedResult = false;
            _canOpenUnsigned32.Value = 0;
            canOpenValueObject.Value = 10;
            _canOpenUnsigned32.IsValueChangedEventRaisingPaused = true;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnsigned32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(false, valueChangedResult);
            _canOpenUnsigned32.IsValueChangedEventRaisingPaused = false;
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);
        }

        /// <summary>
        /// Integer value changed test
        /// </summary>
        [TestMethod]
        public void IntegerValueChangedTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            bool valueChangedResult = false;
            byte nodeId = 103;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenInteger32.ValueChanged += new ValueChangedEventHandler((object sender, ValueChangedEventArgs args) =>
            {
                if ((long)args.CurrentValue == 10 && (long)args.OldValue == 0)
                {
                    valueChangedResult = true;
                }
            });

            // test with valid value
            valueChangedResult = false;
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = 10;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.FinalizeTransfer();
            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with valid value in silent mode
            valueChangedResult = false;
            _canOpenInteger32.Value = 0;
            canOpenValueObject.Value = 10;
            _canOpenInteger32.IsValueChangedEventRaisingPaused = true;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenInteger32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(false, valueChangedResult);
            _canOpenInteger32.IsValueChangedEventRaisingPaused = false;
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);
        }

        /// <summary>
        /// Real32 value changed test
        /// </summary>
        [TestMethod]
        public void Real32ValueChangedTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            bool valueChangedResult = false;
            byte nodeId = 103;
            CanOpenReal32 canOpenValueObject = new CanOpenReal32(0x0032, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenReal32.ValueChanged += new ValueChangedEventHandler((object sender, ValueChangedEventArgs args) =>
            {
                if ((float)args.CurrentValue == 10.5 && (float)args.OldValue == 0)
                {
                    valueChangedResult = true;
                }
            });

            // test with valid value
            valueChangedResult = false;
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 10.5f;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.FinalizeTransfer();
            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with valid value in silent mode
            valueChangedResult = false;
            _canOpenReal32.Value = 0;
            canOpenValueObject.Value = 10.5f;
            _canOpenReal32.IsValueChangedEventRaisingPaused = true;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.ExpeditedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal32.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(false, valueChangedResult);
            _canOpenReal32.IsValueChangedEventRaisingPaused = false;
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);
        }

        /// <summary>
        /// Real64 value changed test
        /// </summary>
        [TestMethod]
        public void Real64ValueChangedTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            bool valueChangedResult = false;
            byte nodeId = 103;
            CanOpenReal64 canOpenValueObject = new CanOpenReal64(0x0064, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenReal64.ValueChanged += new ValueChangedEventHandler((object sender, ValueChangedEventArgs args) =>
            {
                if ((double)args.CurrentValue == 10.5 && (double)args.OldValue == 0)
                {
                    valueChangedResult = true;
                }
            });

            // test with valid value
            valueChangedResult = false;
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 10.5;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.FinalizeTransfer();
            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with valid value in silent mode
            valueChangedResult = false;
            _canOpenReal64.Value = 0;
            canOpenValueObject.Value = 10.5;
            _canOpenReal64.IsValueChangedEventRaisingPaused = true;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenReal64.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(false, valueChangedResult);
            _canOpenReal64.IsValueChangedEventRaisingPaused = false;
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);
        }

        /// <summary>
        /// VisibleString value changed test
        /// </summary>
        [TestMethod]
        public void VisibleStringValueChangedTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            bool valueChangedResult = false;
            byte nodeId = 103;
            CanOpenVisibleString canOpenValueObject = new CanOpenVisibleString(0x0128, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenVisibleString.ValueChanged += new ValueChangedEventHandler((object sender, ValueChangedEventArgs args) =>
            {
                if ((string)args.CurrentValue == "abcd" && (string)args.OldValue == string.Empty)
                {
                    valueChangedResult = true;
                }
            });

            // test with valid value
            valueChangedResult = false;
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.FinalizeTransfer();
            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with valid value in silent mode
            valueChangedResult = false;
            _canOpenVisibleString.Value = string.Empty;
            canOpenValueObject.Value = "abcd";
            _canOpenVisibleString.IsValueChangedEventRaisingPaused = true;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenVisibleString.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(false, valueChangedResult);
            _canOpenVisibleString.IsValueChangedEventRaisingPaused = false;
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);
        }

        /// <summary>
        /// UnicodeString value changed test
        /// </summary>
        [TestMethod]
        public void UnicodeStringValueChangedTest()
        {
            // initialization
            bool isServiceDataObjectDownloadTransferRequest = false;
            bool valueChangedResult = false;
            byte nodeId = 103;
            CanOpenUnicodeString canOpenValueObject = new CanOpenUnicodeString(0x0228, 0x02, true, true);
            ServiceDataObjectDownloadTransfer testObject = null;
            ServiceDataObjectDownloadTransfer clientTransfer = null;
            _canOpenUnicodeString.ValueChanged += new ValueChangedEventHandler((object sender, ValueChangedEventArgs args) =>
            {
                if ((string)args.CurrentValue == "ab" && (string)args.OldValue == string.Empty)
                {
                    valueChangedResult = true;
                }
            });

            // test with valid value
            valueChangedResult = false;
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "ab";
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.FinalizeTransfer();
            System.Threading.Thread.Sleep(100);
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);

            // test with valid value in silent mode
            valueChangedResult = false;
            _canOpenUnicodeString.Value = string.Empty;
            canOpenValueObject.Value = "ab";
            _canOpenUnicodeString.IsValueChangedEventRaisingPaused = true;
            clientTransfer = new ServiceDataObjectDownloadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectDownloadTransferRequest = ServiceDataObjectDownloadTransfer.IsServiceDataObjectDownloadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectDownloadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(canOpenValueObject.Value, _canOpenUnicodeString.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(false, valueChangedResult);
            _canOpenUnicodeString.IsValueChangedEventRaisingPaused = false;
            Assert.AreEqual(true, valueChangedResult);
            Assert.IsNull(clientTransfer.AbortCode);
            Assert.AreEqual(true, clientTransfer.TransferComplete);
        }
        #endregion validation tests


        #region ICanOpenObjectDictionaryContainer
        /// <summary>for internal use</summary>
        private CanOpenUnsigned8 _canOpenUnsigned8 = new CanOpenUnsigned8(0x0008, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger8 _canOpenInteger8 = new CanOpenInteger8(0x0008, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned16 _canOpenUnsigned16 = new CanOpenUnsigned16(0x0016, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger16 _canOpenInteger16 = new CanOpenInteger16(0x0016, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned24 _canOpenUnsigned24 = new CanOpenUnsigned24(0x0024, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger24 _canOpenInteger24 = new CanOpenInteger24(0x0024, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned32 _canOpenUnsigned32 = new CanOpenUnsigned32(0x0032, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger32 _canOpenInteger32 = new CanOpenInteger32(0x0032, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenReal32 _canOpenReal32 = new CanOpenReal32(0x0032, 0x02, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned40 _canOpenUnsigned40 = new CanOpenUnsigned40(0x0040, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger40 _canOpenInteger40 = new CanOpenInteger40(0x0040, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned48 _canOpenUnsigned48 = new CanOpenUnsigned48(0x0048, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger48 _canOpenInteger48 = new CanOpenInteger48(0x0048, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned56 _canOpenUnsigned56 = new CanOpenUnsigned56(0x0056, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger56 _canOpenInteger56 = new CanOpenInteger56(0x0056, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned64 _canOpenUnsigned64 = new CanOpenUnsigned64(0x0064, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger64 _canOpenInteger64 = new CanOpenInteger64(0x0064, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenReal64 _canOpenReal64 = new CanOpenReal64(0x0064, 0x02, true, true);
        /// <summary>for internal use</summary>
        private CanOpenVisibleString _canOpenVisibleString = new CanOpenVisibleString(0x0128, 0x02, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnicodeString _canOpenUnicodeString = new CanOpenUnicodeString(0x0228, 0x02, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned8 _notWriteableCanOpenUnsigned8 = new CanOpenUnsigned8(0x1008, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger8 _notWriteableCanOpenInteger8 = new CanOpenInteger8(0x1008, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned16 _notWriteableCanOpenUnsigned16 = new CanOpenUnsigned16(0x1016, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger16 _notWriteableCanOpenInteger16 = new CanOpenInteger16(0x1016, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned24 _notWriteableCanOpenUnsigned24 = new CanOpenUnsigned24(0x1024, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger24 _notWriteableCanOpenInteger24 = new CanOpenInteger24(0x1024, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned32 _notWriteableCanOpenUnsigned32 = new CanOpenUnsigned32(0x1032, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger32 _notWriteableCanOpenInteger32 = new CanOpenInteger32(0x1032, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenReal32 _notWriteableCanOpenReal32 = new CanOpenReal32(0x1032, 0x02, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned40 _notWriteableCanOpenUnsigned40 = new CanOpenUnsigned40(0x1040, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger40 _notWriteableCanOpenInteger40 = new CanOpenInteger40(0x1040, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned48 _notWriteableCanOpenUnsigned48 = new CanOpenUnsigned48(0x1048, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger48 _notWriteableCanOpenInteger48 = new CanOpenInteger48(0x1048, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned56 _notWriteableCanOpenUnsigned56 = new CanOpenUnsigned56(0x1056, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger56 _notWriteableCanOpenInteger56 = new CanOpenInteger56(0x1056, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned64 _notWriteableCanOpenUnsigned64 = new CanOpenUnsigned64(0x1064, 0x00, true, false);
        /// <summary>for internal use</summary>
        private CanOpenInteger64 _notWriteableCanOpenInteger64 = new CanOpenInteger64(0x1064, 0x01, true, false);
        /// <summary>for internal use</summary>
        private CanOpenReal64 _notWriteableCanOpenReal64 = new CanOpenReal64(0x1064, 0x02, true, false);
        /// <summary>for internal use</summary>
        private CanOpenVisibleString _notWriteableCanOpenVisibleString = new CanOpenVisibleString(0x1128, 0x02, true, false);
        /// <summary>for internal use</summary>
        private CanOpenUnicodeString _notWriteableCanOpenUnicodeString = new CanOpenUnicodeString(0x1228, 0x02, true, false);

        /// <summary>
        /// Gets the node id of the can open object dictionary container
        /// </summary>
        byte ICanOpenObjectDictionaryContainer.NodeId
        {
            get
            {
                return 103;
            }
        }

        /// <summary>
        /// Gets the can open object with the given index as can open data field
        /// object
        /// </summary>
        /// <param name="index">
        /// Index of the can open object to get
        /// </param>
        /// <returns>
        /// The can open object with the given index as data field object or
        /// null
        /// </returns>
        ICanOpenDataFieldObject ICanOpenObjectDictionaryContainer.GetCanOpenObject(UInt16 index)
        {
            return null;
        }

        /// <summary>
        /// Gets the can open object with the given index and sub index as can
        /// open value object
        /// </summary>
        /// <param name="index">
        /// Index of the can open object to get
        /// </param>
        /// <param name="subIndex">
        /// Sub index of the can open object to get
        /// </param>
        /// <returns>
        /// The can open object with the given index and sub index as value
        /// object or null
        /// </returns>
        ICanOpenValueObject ICanOpenObjectDictionaryContainer.GetCanOpenObject(UInt16 index, byte subIndex)
        {
            if (subIndex == 0x00)
            {
                switch (index)
                {
                    case 0x0008:
                        return _canOpenUnsigned8;
                    case 0x1008:
                        return _notWriteableCanOpenUnsigned8;
                    case 0x0016:
                        return _canOpenUnsigned16;
                    case 0x1016:
                        return _notWriteableCanOpenUnsigned16;
                    case 0x0024:
                        return _canOpenUnsigned24;
                    case 0x1024:
                        return _notWriteableCanOpenUnsigned24;
                    case 0x0032:
                        return _canOpenUnsigned32;
                    case 0x1032:
                        return _notWriteableCanOpenUnsigned32;
                    case 0x0040:
                        return _canOpenUnsigned40;
                    case 0x1040:
                        return _notWriteableCanOpenUnsigned40;
                    case 0x0048:
                        return _canOpenUnsigned48;
                    case 0x1048:
                        return _notWriteableCanOpenUnsigned48;
                    case 0x0056:
                        return _canOpenUnsigned56;
                    case 0x1056:
                        return _notWriteableCanOpenUnsigned56;
                    case 0x0064:
                        return _canOpenUnsigned64;
                    case 0x1064:
                        return _notWriteableCanOpenUnsigned64;
                }
            }
            else if (subIndex == 0x01)
            {
                switch (index)
                {
                    case 0x0008:
                        return _canOpenInteger8;
                    case 0x1008:
                        return _notWriteableCanOpenInteger8;
                    case 0x0016:
                        return _canOpenInteger16;
                    case 0x1016:
                        return _notWriteableCanOpenInteger16;
                    case 0x0024:
                        return _canOpenInteger24;
                    case 0x1024:
                        return _notWriteableCanOpenInteger24;
                    case 0x0032:
                        return _canOpenInteger32;
                    case 0x1032:
                        return _notWriteableCanOpenInteger32;
                    case 0x0040:
                        return _canOpenInteger40;
                    case 0x1040:
                        return _notWriteableCanOpenInteger40;
                    case 0x0048:
                        return _canOpenInteger48;
                    case 0x1048:
                        return _notWriteableCanOpenInteger48;
                    case 0x0056:
                        return _canOpenInteger56;
                    case 0x1056:
                        return _notWriteableCanOpenInteger56;
                    case 0x0064:
                        return _canOpenInteger64;
                    case 0x1064:
                        return _notWriteableCanOpenInteger64;
                }
            }
            else if (subIndex == 0x02)
            {
                switch (index)
                {
                    case 0x0032:
                        return _canOpenReal32;
                    case 0x1032:
                        return _notWriteableCanOpenReal32;
                    case 0x0064:
                        return _canOpenReal64;
                    case 0x1064:
                        return _notWriteableCanOpenReal64;
                    case 0x0128:
                        return _canOpenVisibleString;
                    case 0x1128:
                        return _notWriteableCanOpenVisibleString;
                    case 0x0228:
                        return _canOpenUnicodeString;
                    case 0x1228:
                        return _notWriteableCanOpenUnicodeString;
                }
            }
            return null;
        }
        #endregion ICanOpenObjectDictionaryContainer

    }

}
